<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function* startGame() {
            const answer = yield "Do you love JavaScript?";
            if (answer !== "Yes") {
                return "Oh wow... Guess we're gone here";
            }
            return "JavaScript loves you back ❤️";
        }

        const game = startGame();
        console.log(game.next().value)
        console.log(game.next('Yes').value)
        console.log(/* 1 */); // Do you love JavaScript?
        console.log(/* 2 */); // JavaScript loves you back ❤️

    </script>
</body>

</html>